package com.lzx.reggie.controller;

import com.lzx.reggie.common.R;
import com.lzx.reggie.entity.Orders;
import com.lzx.reggie.service.OrdersService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
@RestController
@Slf4j
@RequestMapping("/order")
public class OrdersController {

    private final OrdersService ordersService;

    /**
     * 用户下单
     * @param orders
     * @return
     */
    @PostMapping("/submit")
    public R<String> submit(@RequestBody Orders orders){
        log.info("订单数据为：{}",orders);

        ordersService.submit(orders);

        return R.success("下单成功...");
    }

}
